<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="../include/admincontent.jsp" %>
<div id="Content">
    <div id="searchbox">
        <table class="treeTable searchform">
            <thead>
            <tr>
                <td width="75">岗位编码：</td>
                <td width="120">
                    <div><input type="text" name="code"/></div>
                </td>
                <td width="75">岗位名称：</td>
                <td width="120">
                    <div><input type="text" name="name"/></div>
                </td>
                <td>
                    <button id="searchbtn" type="button" class="search"></button>
                </td>
            </tr>
            </thead>
        </table>
    </div>
    <table class="treeTable" id="tablelist">
        <thead>
        <tr>
            <td width="50">序号</td>
            <td width="80">岗位编码</td>
            <td width="180">岗位名称</td>
            <td>所属部门</td>
            <td width="60">选择</td>
        </tr>
        </thead>
        <tbody id="result"></tbody>
    </table>
    <div id="page"></div>
</div>
<script type="text/javascript">
    $(document).ready(function () {
        getList();
        $('#searchbtn').click(function () {
            getList();
        });
        $(document).delegate('#result .link a', 'click', function () {
            parent.$('#jobcode').val($(this).parent().prev().prev().prev().text());
            parent.$('#jobname').val($(this).parent().prev().prev().text());
            var index = parent.layer.getFrameIndex(window.name);
            parent.layer.close(index);
        });
    });

    function getList() {
        $("#page").myPagination({
            cssStyle: "pagination",
            ajax: {
                on: true,
                url: '/SysAdmin/getJobLists?code=' + $('input[name=code]').val() + '&name=' + $('input[name=name]').val() + '&deptcode=' + getUrlParam('deptcode'),
                dataType: 'html',
                callback: function (data) {
                    $("#result").html(data);
                }
            }
        });
    }
</script>
</body>
</html>